Description
The PostToGameObject
method is a static method of the ISceneEvent<T>
interface. It allows you to post an event to a specific GameObject
without affecting its descendants. This method is useful when you want to trigger an event on a particular game object in the scene, ensuring that only the specified object receives the event.
Usage
To use the PostToGameObject
method, you need to provide a GameObject
instance and an action delegate that defines the event to be posted. The action delegate should be of type System.Action<T>
, where T
is the event type you are working with.
Example
// Example usage of PostToGameObject
GameObject myGameObject = new GameObject();
ISceneEvent<MyEventType>.PostToGameObject(myGameObject, eventInstance =>
{
eventInstance.OnEventTriggered();
});